package hu.debrecen.adastra.card.repository.domain.social;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;

import org.springframework.data.domain.Persistable;

@Entity(name = "UserConnection")
public class UserConnection implements Persistable<UserConnectionPK> {

	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private UserConnectionPK connectionPK;

	@Column(name = "rank", nullable = false)
	private Integer rank;

	@Column(name = "displayName", length = 255)
	private String displayName;

	@Column(name = "profileUrl", length = 512)
	private String profileUrl;

	@Column(name = "imageUrl", length = 512)
	private String imageUrl;

	@Column(name = "accessToken", length = 255, nullable = false)
	private String accessToken;

	@Column(name = "secret", length = 255)
	private String secret;

	@Column(name = "refreshToken", length = 255)
	private String refreshToken;

	@Column(name = "expireTime")
	private Long expireTime;

	public UserConnection() {
		super();
	}

	public UserConnectionPK getConnectionPK() {
		return this.connectionPK;
	}

	public void setConnectionPK(final UserConnectionPK connectionPK) {
		this.connectionPK = connectionPK;
	}

	public Integer getRank() {
		return this.rank;
	}

	public void setRank(final Integer rank) {
		this.rank = rank;
	}

	public String getDisplayName() {
		return this.displayName;
	}

	public void setDisplayName(final String displayName) {
		this.displayName = displayName;
	}

	public String getProfileUrl() {
		return this.profileUrl;
	}

	public void setProfileUrl(final String profileUrl) {
		this.profileUrl = profileUrl;
	}

	public String getImageUrl() {
		return this.imageUrl;
	}

	public void setImageUrl(final String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String getAccessToken() {
		return this.accessToken;
	}

	public void setAccessToken(final String accessToken) {
		this.accessToken = accessToken;
	}

	public String getSecret() {
		return this.secret;
	}

	public void setSecret(final String secret) {
		this.secret = secret;
	}

	public String getRefreshToken() {
		return this.refreshToken;
	}

	public void setRefreshToken(final String refreshToken) {
		this.refreshToken = refreshToken;
	}

	public Long getExpireTime() {
		return this.expireTime;
	}

	public void setExpireTime(final Long expireTime) {
		this.expireTime = expireTime;
	}

	@Override
	public UserConnectionPK getId() {
		return this.connectionPK;
	}

	@Override
	public boolean isNew() {
		return this.getId() == null;
	}

}
